home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / text / hyper / hsc_source.lha / hsc / source / hsclib / tag.h < prev    next >
C/C++ Source or Header  |  1996-08-04  |  5KB  |  153 lines

  1. /*
  2.  * hsclib/tag.h
  3.  *
  4.  * tag structure and functions
  5.  *
  6.  */
  7.  
  8. #ifndef HSCLIB_TAG_H
  9. #define HSCLIB_TAG_H
  10.  
  11. /*
  12.  * defines
  13.  */
  14. #define HSC_TAGID        "$"
  15. #define HSC_COMMENT_STR  "*"
  16. #define HSC_ONLYCOPY_STR "|"
  17. #define HSC_INSEXPR_STR  "("
  18. #define HSC_DEFENT_STR   HSC_TAGID "DEFENT"
  19. #define HSC_DEFICON_STR  HSC_TAGID "DEFICON"
  20. #define HSC_DEFINE_STR   HSC_TAGID "DEFINE"
  21. #define HSC_DEFTAG_STR   HSC_TAGID "DEFTAG"
  22. #define HSC_ELSE_STR     HSC_TAGID "ELSE"
  23. #define HSC_ELSEIF_STR   HSC_TAGID "ELSEIF"
  24. #define HSC_EXEC_STR     HSC_TAGID "EXEC"
  25. #define HSC_EXPORT_STR   HSC_TAGID "EXPORT"
  26. #define HSC_IF_STR       HSC_TAGID "IF"
  27. #define HSC_INCLUDE_STR  HSC_TAGID "INCLUDE"
  28. #define HSC_INSERT_STR   HSC_TAGID "INSERT"
  29. #define HSC_LET_STR      HSC_TAGID "LET"
  30. #define HSC_MACRO_STR    HSC_TAGID "MACRO"
  31. #define HSC_MESSAGE_STR  HSC_TAGID "MESSAGE"
  32. #define HSC_SOURCE_STR   HSC_TAGID "SOURCE"
  33.  
  34. #define HSC_TEXT_STR     "TEXT"
  35. #define HSC_TIME_STR     "TIME"
  36.  
  37. struct hscprocess;              /* forward reference */
  38.  
  39. /*
  40.  * structure & typdef for tag
  41.  */
  42. typedef struct hsctag
  43. {
  44.     STRPTR name;                /* tag name, eg "TITLE" */
  45.     ULONG option;               /* tag options, eg HT_CLOSE|HT_REQUIRED */
  46.       BOOL(*o_handle) (struct hscprocess * hp, struct hsctag * tag);
  47.     /* callback for start-tag */
  48.       BOOL(*c_handle) (struct hscprocess * hp, struct hsctag * tag);
  49.     /* callback for end-tag */
  50.     DLLIST *attr;               /* list of attributes */
  51.     EXPSTR *op_text;            /* macro text (open/close) */
  52.     EXPSTR *cl_text;
  53.     STRPTR mbi;                 /* string that tells inside which
  54.                                  * tag this tag has to be
  55.                                  * e.g. for <LI>: "ul|ol|dir|menu" */
  56.     STRPTR naw;                 /* "not allowed within */
  57.     HSCVAR *uri_stripext;       /* if this uri attribute's value is
  58.                                  * an external uri, tag is stripped */
  59.     HSCVAR *uri_size;           /* with this uri, values for WIDTH and
  60.                                  * HEIGHT and can be evaluated */
  61.     INFILEPOS *start_fpos;      /* for macros: location of def. */
  62.     INFILEPOS *end_fpos;        /* for endtag: location of start tag */
  63.     BOOL occured;               /* TRUE, if tag already occured */
  64.     /* NOTE: the occured-flag is also set by def_tagname(),
  65.      *   if a new macro already exists. the warning message
  66.      *   is displayed later within def_tag_args(), where
  67.      *   also the occured-flag is reset to FALSE. see "deftag.c"
  68.      */
  69. }
  70. HSCTAG;
  71.  
  72. /*
  73.  * defines
  74.  */
  75. #define HT_NOCOPY      (1<<0)   /* avoid copying of tag text */
  76. #define HT_CLOSE       (1<<1)   /* closing tag required */
  77. #define HT_REQUIRED    (1<<2)   /* tag required at least once in file */
  78. #define HT_ONLYONCE    (1<<3)   /* tag required at most once in file */
  79. #define HT_SPECIAL     (1<<4)   /* do not evaluate attributes, call handler */
  80. #define HT_OBSOLETE    (1<<5)   /* tag is already obsolete */
  81. #define HT_JERK        (1<<6)   /* netscape externsion & co. */
  82. #define HT_AUTOCLOSE   (1<<7)   /* ignore closing tags (<P> and <LI>) */
  83. #define HT_NOBP        (1<<8)   /* TODO: warning if <P> before tag */
  84. #define HT_NOAP        (1<<9)   /* TODO: -"- after tag */
  85. #define HT_MACRO       (1<<10)  /* macro tag */
  86. #define HT_NOHANDLE    (1<<11)  /* don't call tag handles */
  87. #define HT_WHTSPC      (1<<12)  /* warn about pre/succ-ceeding white-spaces */
  88. #define HT_SKIPLF      (1<<13)  /* skip possible LF after tag */
  89. #define HT_UNKNOWN     (1<<14)  /* unknown tag (temporary created) */
  90.  
  91. #define HT_KEEP_QUOTES (1<<30)  /* keep quotes for all attributes */
  92.  
  93. /* tag options that can be set via DEFTAG */
  94. #define TO_CLOSE_STR       "CLOSE"
  95. #define TO_CLOSE_SHT       "C"
  96. #define TO_SPECIAL_STR     "SPECIAL"
  97. #define TO_SPECIAL_SHT     "SPC"
  98. #define TO_JERK_STR        "JERK"
  99. #define TO_JERK_SHT        "J"
  100. #define TO_LAZY_STR        "LAZY"
  101. #define TO_LAZY_SHT        "L"
  102. #define TO_MBI_STR         "MUST_BE_INSIDE"
  103. #define TO_MBI_SHT         "MBI"
  104. #define TO_NAW_STR         "NOT_ALLOWED_WITHIN"
  105. #define TO_NAW_SHT         "NAW"
  106. #define TO_AUTOCLOSE_STR   "AUTOCLOSE"
  107. #define TO_AUTOCLOSE_SHT   "AC"
  108. #define TO_ONLYONCE_STR    "ONLYONCE"
  109. #define TO_ONLYONCE_SHT    "1"
  110. #define TO_OBSOLETE_STR    "OBSOLETE"
  111. #define TO_OBSOLETE_SHT    "O"
  112. #define TO_REQUIRED_STR    "REQUIRED"
  113. #define TO_REQUIRED_SHT    "R"
  114. #define TO_SKIPLF_STR      "SKIPLF"
  115. #define TO_SKIPLF_SHT      "S"
  116. #define TO_WHTSPC_STR      "WHTSPC"
  117. #define TO_WHTSPC_SHT      "W"
  118.  
  119. /* TODO: think about this tag-options */
  120. #define TO_VERS_STR        "VERS"
  121. #define TO_VERS_SHT        "V"
  122.  
  123. /* decides if a tag is a hsc-tag */
  124. #define is_hsc_tag( tag ) (!upstrncmp(((tag)->name),HSC_TAGID,strlen(HSC_TAGID)))
  125.  
  126. /* decides if a tag is a macro-tag */
  127. #define is_macro_tag( tag ) ((tag)->option & HT_MACRO )
  128.  
  129. /* find closing tag on container stack */
  130. #define find_ctag( name ) find_strtag( cltags, name )
  131.  
  132. /*
  133.  *
  134.  * extern references
  135.  *
  136.  */
  137. #ifndef NOEXTERN_HSCLIB_TAG_H
  138.  
  139. extern HSCTAG *new_hsctag(STRPTR newid);
  140. extern VOID del_hsctag(APTR data);
  141. extern HSCTAG *cpy_hsctag(HSCTAG * oldtag);
  142.  
  143. extern int cmp_strtag(APTR cmpstr, APTR tagdata);
  144. extern HSCTAG *find_strtag(DLLIST * taglist, STRPTR name);
  145. extern int cmp_strctg(APTR cmpstr, APTR tagstr);
  146.  
  147. extern HSCTAG *app_tag(DLLIST * taglist, STRPTR tagid);
  148.  
  149. #endif /* NOEXTERN_HSCLIB_TAG_H */
  150.  
  151. #endif /* HSCLIB_TAG_H */
  152.  
  153.